package cn.gzjp.modules.logis.entity;

import java.util.List;

import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonBackReference;

import cn.gzjp.common.persistence.DataEntity;
import cn.gzjp.common.utils.excel.annotation.ExcelField;

/**
 * 新闻类型Entity
 * @author zengcp
 * @version 2017-08-17
 */
public class NewsType extends DataEntity<NewsType> {
	
	private static final long serialVersionUID = 1L;
	private String name;		// 名称
	private NewsType parent;		// 上级id
	private Integer sort;		// 排序
	private String parentIds;		// 所有父级编号
	private List<NewsType> children;	// 子菜单

	private int carCount;		// 车辆数
	private int maxCarCount;    //最大车辆数

	private String lingdanStatus;//0未开通 1已开通
	
	public NewsType() {
		super();
	}

	public NewsType(String id){
		super(id);
	}

	@Length(min=0, max=64, message="名称长度必须介于 0 和 64 之间")
	@ExcelField(title="名称", align=2, sort=1)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@JsonBackReference
	@ExcelField(title="上级id", align=2, sort=3)
	public NewsType getParent() {
		return parent;
	}

	public void setParent(NewsType parent) {
		this.parent = parent;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public String getParentIds() {
		return parentIds;
	}

	public void setParentIds(String parentIds) {
		this.parentIds = parentIds;
	}

	public List<NewsType> getChildren() {
		return children;
	}

	public void setChildren(List<NewsType> children) {
		this.children = children;
	}
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
	@ExcelField(title="车辆数", align=2, sort=5)
	public int getCarCount() {
		return carCount;
	}

	public void setCarCount(int carCount) {
		this.carCount = carCount;
	}

	public int getMaxCarCount() {
		return maxCarCount;
	}

	public void setMaxCarCount(int maxCarCount) {
		this.maxCarCount = maxCarCount;
	}

	public String getLingdanStatus() {
		return lingdanStatus;
	}

	public void setLingdanStatus(String lingdanStatus) {
		this.lingdanStatus = lingdanStatus;
	}
}